// same as 

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import java.rmi.RMISecurityManager;

public class SeedServer extends UnicastRemoteObject implements SeedService
{
	//int magical=1;

	public SeedServer(int port) throws RemoteException
	{
		super(port);
	}
 
	public void print(String txt) throws RemoteException
	{
		System.out.println(txt);
	}
 
	public void changeMagical(int newMagic) throws RemoteException
	{
		System.out.println(magical+" -> "+newMagic);
		magical=newMagic;
	}
 
	public static void main(String[] args)
	{
		//if (System.getSecurityManager() == null)
		//	System.setSecurityManager(new RMISecurityManager());
		try
		{
			Registry rmiRegistry =  LocateRegistry.createRegistry(9999);
			SeedService seedService = new SeedServer(9999);
			rmiRegistry.bind("SeedService", seedService);
		}

		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

